<template>
    <form>
         <!-- <label v-if="label">{{label}}</label> -->
        <slot></slot>
         {{errorMessage}}
    </form>
</template>
<script>
export default {
    name:'elFormItem',
    props:{
        lable:{
            type:String,
            default:''
        },
        prop:String
    },
    inject:['elForm'],
    mounted(){
        // this.$emit this.$on 每次输出都会监听到---校验
        this.$on('validate',()=>{
           this.validate()
        })
    },
    data() {
        return {errorMessage:''}
    },
    methods: {
        validate(){
              let newValue = this.elForm.model[this.prop];
                let rule = this.elForm.rules[this.prop];
                // async-validator  -> api
                return false;
        }
    },
}
</script>